package com.jxdinfo.hussar.example.common.schedulingtask.controller;

import com.jxdinfo.hussar.example.common.schedulingtask.ProWorkerScheduleTask;
import com.jxdinfo.hussar.example.common.schedulingtask.dao.MdUnitMeasureMapper;
import com.jxdinfo.hussar.example.common.schedulingtask.service.*;
import com.jxdinfo.hussar.example.mes.md.service.impl.MdErpenumServiceImpl;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author QiaoBin
 * @Date 2024/4/1 15:28
 * @PackageName com.jxdinfo.hussar.example.mes.erpToMes.synchronizationerp.controller
 * @ClassName SynchronizationController
 * @Description: 同步erp控制层
 * @Version 1.0
 */
@RestController
@RequestMapping("/synchronizationerp")
public class SynchronizationController {

    @Autowired
    private MdClientService mdClientService;

    @Autowired
    private MdItemService mdItemService;

    @Autowired
    private MdItemTypeService mdItemTypeService;

    @Autowired
    private ProWorkorderService proWorkorderService;

    @Autowired
    private MdUnitMeasureService mdUnitMeasureService;

    @Autowired
    private MdVendorService mdVendorService;

    @Autowired
    private MdWorkshopService mdWorkshopService;

    @Autowired
    private WmWarehouseService wmWarehouseService;

    @Autowired
    private MdErpenumServiceImpl mdErpenumService;



    /**
     * @Author QiaoBin
     * @Date 2024/4/10 10:49
     * @Description 工单表的手动同步接口
     */
    @PostMapping("/proWorkOrderSynchronizationErp")
    public ApiResponse proWorkOrderSynchronizationErp(){
        proWorkorderService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }

    /**
     * @Author QiaoBin
     * @Date 2024/4/1 15:53
     * @Description 客户管理的数据同步接口
     */
    @PostMapping("/clientManageSynchronizationErp")
    public ApiResponse clientManageSynchronizationErp(){
        mdClientService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }

    /**
     * @Author QiaoBin
     * @Date 2024/4/1 15:53
     * @Description md_item的数据同步接口
     */
    @PostMapping("/materialProductManageSynchronizationErp")
    public ApiResponse materialProductManageSynchronizationErp(){
        mdItemService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }

    /**
     * @Author QiaoBin
     * @Date 2024/4/1 15:53
     * @Description 物料产品分类表的数据同步接口
     */
    @PostMapping("/materialProductSortSynchronizationErp")
    public ApiResponse materialProductSortSynchronizationErp(){
        mdItemTypeService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }



    /**
     * @Author QiaoBin
     * @Date 2024/4/1 15:53
     * @Description 计量单位的数据同步接口
     */
    @PostMapping("/measureUnitSynchronizationErp")
    public ApiResponse measureUnitSynchronizationErp(){
        mdUnitMeasureService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }

    /**
     * @Author QiaoBin
     * @Date 2024/4/1 15:53
     * @Description 供应商管理的数据同步接口
     */
    @PostMapping("/venderManageSynchronizationErp")
    public ApiResponse venderManageSynchronizationErp(){
        mdVendorService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }
    /**
     * @Author QiaoBin
     * @Date 2024/4/1 15:53
     * @Description 车间设置的数据同步接口
     */
    @PostMapping("/workshopSynchronizationErp")
    public ApiResponse workshopSynchronizationErp(){
        mdWorkshopService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }

    @PostMapping("/wareHouseSynchronizationErp")
    public ApiResponse wareHouseSynchronizationErp(){
        wmWarehouseService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }


    /**
     * @Author QiaoBin
     * @Date 2024/4/1 15:53
     * @Description 工作站的数据同步接口
     */
    @PostMapping("/workstationSynchronizationErp")
    public ApiResponse workstationSynchronizationErp(){
        return ApiResponse.success("同步成功");
    }


    /**
     * @Author QiaoBin
     * @Date 2024/4/1 15:53
     * @Description 枚举的数据同步接口
     */
    @PostMapping("/enumSynchronizationErp")
    public ApiResponse enumSynchronizationErp(){
        mdErpenumService.manualSynchronization();
        return ApiResponse.success("同步成功");
    }

}
